package com.demo.gulimall.cart.config;

import com.demo.gulimall.cart.interceptor.CartInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 拦截器配置
 * @author Chen Yuan
 * @create 2023-06-19  15:22
 */
@Configuration
public class MallWebConfig implements WebMvcConfigurer {

	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		// 添加拦截器, "/**"  拦截所有请求
		registry.addInterceptor(new CartInterceptor()).addPathPatterns("/**");
	}
}
